package org.e_gold.dao.impl;

import org.e_gold.dao.CookieDAO;
import org.e_gold.model.Cookie;
import org.e_gold.util.BrowserTypeENUM;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public class CookieDAOImpl extends AbstractGenericDAO<Cookie> implements CookieDAO {

	public CookieDAOImpl() {

		super(Cookie.class);
	}

	@Override
	@Transactional
	public Cookie findCookieByName(String key) {

		return (Cookie) getCurrentSession()
				.getNamedQuery("findCookieByName")
				.setString("name", key)
				.setString("browserType", BrowserTypeENUM.FIREFOX_VERSION.toString())
				.uniqueResult();
	}

}
